package com.buleqr.controller;

import com.buleqr.dto.response.UserRelactionShipListVo;
import com.buleqr.pojo.AjaxResult;
import com.buleqr.pojo.PageDomain;
import com.buleqr.pojo.PageList;
import com.buleqr.pojo.UserRelactionShip;
import com.buleqr.service.UserRelactionShipService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author buleqr
 */
@Api(tags = "好友申请管理")
@RestController
@RequestMapping("/UserRelactionShip")
public class UserRelactionShipController {

    private final UserRelactionShipService userRelactionShipService;

    public UserRelactionShipController(UserRelactionShipService userRelactionShipService) {
        this.userRelactionShipService = userRelactionShipService;
    }

    /**
     * 发送好友申请
     * @param userRelactionShip 申请内容
     */
    @ApiOperation("发送好友申请")
    @PostMapping("/send")
    public AjaxResult sendFriendRequestVerification(@RequestBody UserRelactionShip userRelactionShip) {
        AjaxResult ajaxResult = AjaxResult.success("好友申请发送成功",userRelactionShipService.sendFriendRequestVerification(userRelactionShip));
        return ajaxResult;
    }

    /**
     * 查询好友申请列表
     * @param pageDomain 参数
     * @return 好友申请列表
     */
    @ApiOperation("查询好友申请列表")
    @PostMapping("/list")
    public AjaxResult selectFriendRequestList(@RequestBody PageDomain pageDomain) {
        AjaxResult ajaxResult = AjaxResult.success(userRelactionShipService.selectFriendRequestList(pageDomain));
        return ajaxResult;
    }
}
